/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nus.application.web.base.form;

import org.displaytag.pagination.PaginatedList;
import org.displaytag.properties.SortOrderEnum;

/**
 *
 * @author robin.foe
 */
public abstract class BaseForm implements PaginatedList {

    @Override
    public String getSearchId() {return null;}

    private int pageNumber = 1;
    @Override
    public int getPageNumber() {return this.pageNumber;}
    public void setPageNumber(int pageNumber){ this.pageNumber = pageNumber;}

    private int objectsPerPage = 5;
    @Override
    public int getObjectsPerPage() {return this.objectsPerPage;}
    public void setObjectsPerPage(int objectsPerPage){this.objectsPerPage = objectsPerPage;}
    
    private int fullListSize=100;
    @Override
    public int getFullListSize() {return this.fullListSize;}
    public void setFullListSize(int fullListSize){this.fullListSize = fullListSize;}

    private String sortCriterion;
    @Override
    public String getSortCriterion() {return sortCriterion;}
    public void setSortCriterion(String sortCriterion){this.sortCriterion = sortCriterion;}
    
    private SortOrderEnum sortDirection;
    @Override
    public SortOrderEnum getSortDirection() {return this.sortDirection;}
    public void setSortDirection(SortOrderEnum sortDirection){this.sortDirection = sortDirection;}
 
    public int calculateStartRow(int currPage){
        return (currPage-1) * this.getObjectsPerPage();
    }
    
    private int selectedIndex;
    public int getSelectedIndex() {return selectedIndex;}
    public void setSelectedIndex(int selectedIndex) {this.selectedIndex = selectedIndex;}
    
}
